NVO3 may implement a layer 2 virtual private network (VPN) by using media access processing (MAC) in Internet protocol (IP) encapsulation. Virtual extensible local area network (VXLAN) and network virtualization generic routing encapsulation (NVGRE) are two typical technologies for implementing NVO3 networking. For VXLAN and NVGRE, by using MAC in user datagram protocol (UDP) encapsulation or MAC in GRE encapsulation, layer 2 packets in different VPNs may be transmitted across a layer 3 IP network. VXLAN tunnel encapsulation and NVGRE tunnel encapsulation both include a 24-bit virtual overlay network (VN) identifier (ID). By encapsulating a VN ID in a packet, traffic may be isolated between different virtual overlay networks. In a data center, one tenant may correspond to one or more virtual overlay networks.
A VN edge device is called a network virtualization edge (NVE), and a main function of the NVE is to join a tenant end system (TES) to a virtual overlay network. The NVE may isolate traffic between different virtual overlay networks by using VN IDs. Corresponding multicast and unicast forwarding tables of each virtual overlay network are stored in the NVE. The NVE replicates and sends, according to a local multicast forwarding table, multicast traffic (including unknown unicast, broadcast, and multicast, which are uniformly referred to as multicast herein) sent by a local TES to another TES. The NVE replicates and forwards, according to a network-side multicast forwarding table corresponding to a virtual overlay network of the TES, the multicast traffic sent by the local TES, to a remote NVE. When a multicast packet is sent to a remote NVE, two manners, head-end replication and multicast hop-by-hop replication, may be used. Unicast NVO3 encapsulation is used in the head-end replication manner, where a destination IP of a tunnel is an IP address of a destination NVE. In the multicast replication manner, the destination IP of a tunnel is a multicast IP address. A correspondence between VNs and multicast IP addresses is preset on each NVE by a network administrator. By searching a unicast forwarding table, an NVE forwards, to a local TES or a remote NVE, a unicast packet sent by a TES. When the unicast packet is forwarded to the remote NVE, unicast NVO3 encapsulation needs to be performed on the unicast packet.
FIG. 1 is a schematic structural diagram of an NVO3 network in the prior art. Each TES separately accesses a VN by using a respective NVE. To ensure TES reliability, a TES may access a network by using multiple NVEs. As shown in FIG. 1, a TES 1 accesses the NVO3 network separately by using a port 1 of an NVE 1 and a port 2 of an NVE 2. This access manner is called multihoming access. The NVE 1 and the NVE 2 for connecting the TES 1 are called multihoming NVEs. The port 1 of the NVE 1 and the port 2 of the NVE 2 form a cross-device link aggregation group (LAG). TES1 is called a multihomed TES, and an NVE other than a multihoming NVE is called a remote NVE of the multihoming NVE. When the multiple multihoming NVEs can all forward a packet from the multihomed TES, this access manner is called all-active or active-active access.
In an all-active or active-active scenario, for a multicast packet in a VN, it is required that:
1. When multihoming NVEs replicate and forward, to a local port, a multicast packet sent by a remote NVE, it is avoided that a multihomed TES receives multiple copies of the multicast packet sent by the remote NVE, and
2. A split horizon mechanism can be provided between the multihoming NVEs, to avoid that a packet sent by a multihomed TES is looped back to the multihomed TES by using an NVO3 network.
In the prior art, a horizontal splitting method is provided. A multihoming NVE configures, for each LAG, an IP address as a source IP address for the multihoming NVE to send a packet by using a port in the LAG The multihoming NVE records a correspondence between the LAG and the IP address. NVEs on the NVO3 network are mutually notified of their correspondences between LAGs and IP addresses, and each NVE records correspondences between LAGs and IP addresses of other NVEs.
After receiving a multicast packet sent by a second NVE, a first NVE searches, according to a source IP address in the multicast packet, a correspondence between LAGs and IP addresses that is recorded by the first NVE. If there is no LAG corresponding to the source IP address, the first NVE replicates, according to a VN ID in the multicast packet, the multicast packet to all local ports corresponding to the VN ID. If there is a LAG corresponding to the source IP address, and the first NVE and the second NVE belong to a same LAG, the first NVE does not replicate the multicast packet to a local port corresponding to the LAG The local port refers to a port connected to a TES.
Research finds that, in the foregoing horizontal splitting method, the multihoming NVE needs to allocate an IP address to each LAG If there is a large quantity of LAGs on a network, IP address wasting is caused. In addition, each multihoming NVE needs to determine whether an IP address of every other multihoming NVE and an IP address of the multihoming NVE belong to a same LAG Consequently, packet forwarding efficiency drops if there is a large quantity of multihoming NVEs.